<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>考试列表 - 监考管理系统</title>
    <meta th:replace="~{/head/head_include ::  title}"/>
    <link rel="stylesheet" th:href="@{/head_res/bootstrapvalidator/css/form-validation.css}">
    <script type="text/javascript" th:src="@{/head_res/bootstrapvalidator/js/form-validation.js}"></script>
    <script type="text/javascript" charset="utf-8" th:src="@{/head_res/ueditor/ueditor.config.js}"></script>
    <script type="text/javascript" charset="utf-8" th:src="@{/head_res/ueditor/ueditor.all.min.js}"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" th:src="@{/head_res/ueditor/lang/zh-cn/zh-cn.js}"></script>
    <script type="text/javascript" th:inline="javascript">
        $(function()
        {
            $("#form").FormValidation({
                fields:
                    {
                        /* 邮箱 */
                        name:
                        {
                            validators: {
                                notEmpty: {
                                    message: '名称不能为空'
                                },
                                stringLength: {
                                    min: 4,
                                    max:40,
                                    message: '名称的长度为在4位与40位之间'
                                }
                            }
                        },
                        intvigNum:
                        {
                            validators: {
                                notEmpty: {
                                    message: '监考人数不能为空'
                                },
                                stringLength: {
                                    min: 4,
                                    max:40,
                                    message: '监考人数的长度为在4位与40位之间'
                                },
                                regex: {
                                    regexp: /^\d+$/i,
                                    message: '监考人数只能为数字'
                                }
                            }
                        }
                    }
            });

            var ue = UE.getEditor('editor');
            var content = [[${one?.content}]];
            /* 百度编辑器提供的方法 */
            ue.addListener("ready", function () {
                /* 为百度编辑器赋值 */
                ue.setContent(content);
            });
        });
    </script>
</head>
<body>
<meta th:replace="~{/head/head_include ::  header}"/>
<!-- 网页的主体 -->
<div class="container">
    <div class="col-md-8 col-sm-10">
        <form id="form" class="form-horizontal" method="post"
              th:action="@{/head/exam/examDescInsertSubmit}">

            <h2 class="col-sm-10 col-sm-offset-1 form-signin-heading text-center">添加考试</h2>
            <div class="form-group">
                <label for="name" class="col-sm-3 control-label">名称</label>
                <div class="col-sm-8">
                    <input type="text" id="name" name="entity.name" class="form-control"
                           th:value="${one.name}" placeholder="名称">
                </div>
            </div>
            <div class="form-group">
                <label for="currDate" class="col-sm-3 control-label">日期</label>
                <div class="col-sm-8">
                    <input type="text" name="currDate" th:value="${#dates.format(one.currDate,'yyyy-MM-dd')}" readonly="true"
                           class="form-control mr-sm-2"
                           onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                </div>
            </div>
            <div class="form-group">
                <label for="name" class="col-sm-3 control-label">学年</label>
                <div class="col-sm-8">
                    <input type="text" id="schoolYear" name="entity.schoolYear" class="form-control"
                           th:value="${one.schoolYear}" placeholder="学年">
                </div>
            </div>
            <div class="form-group">
                <label for="name" class="col-sm-3 control-label">班级</label>
                <div class="col-sm-8">
                    <input type="text" id="clazz" name="entity.clazz" class="form-control"
                           th:value="${one.clazz}" placeholder="班级">
                </div>
            </div>
            <div class="form-group">
                <label for="name" class="col-sm-3 control-label">地址</label>
                <div class="col-sm-8">
                    <input type="text" id="address" name="entity.address" class="form-control"
                           th:value="${one.address}" placeholder="地址">
                </div>
            </div>
            <div class="form-group">
                <label for="name" class="col-sm-3 control-label">副监考人数</label>
                <div class="col-sm-8">
                    <input type="text" id="intvigNum" name="entity.intvigNum" class="form-control"
                           th:value="${one.intvigNum}" placeholder="副监考人数">
                </div>
            </div>
            <div class="form-group">
                <label for="content" class="col-sm-2 control-label">内容:</label>
                <div class="col-sm-8">
                    <script id="editor" name="entity.content" type="text/plain" style="width:800px;height:300px;" th:text="${one.content}"></script>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8 col-sm-offset-2">
                    <button class="btn btn-md btn-primary" type="submit">提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
<meta th:replace="~{/head/head_include ::  footer}"/>
</body>
</html>